home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 52 / Amiga Format AFCD52 (Issue 136, May 2000).iso / -serious- / programming / c / stormamiga_lib-v45_00d / include / sys / types.h < prev    next >
C/C++ Source or Header  |  2000-02-28  |  3KB  |  124 lines

  1. #ifndef SYS_TYPES_H
  2. #define SYS_TYPES_H
  3.  
  4. /*
  5. **       $VER: sys/types.h 1.5 (31.10.99)
  6. **            Includes Release 45.00
  7. **
  8. **    Copyright © 1996/2000 by CyberdyneSystems
  9. **
  10. **            written by Matthias Henze
  11. **               All Rights Reserved
  12. */
  13.  
  14. #ifndef STORMAMIGA_H
  15.   #include <stormamiga.h>
  16. #endif
  17. #ifndef  _INCLUDE_STRING_H
  18.   #include <string.h>
  19. #endif
  20.  
  21. typedef ulong   vm_offset_t;
  22. typedef ulong   vm_size_t;
  23.  
  24. typedef int     ssize_t;
  25.  
  26. /* Basic integral types. */
  27. #define __BIT_TYPES_DEFINED__
  28. typedef schar     int8_t;
  29. typedef uchar     u_int8_t;
  30. typedef short     int16_t;
  31. typedef ushort    u_int16_t;
  32. typedef int       int32_t;
  33. typedef uint      u_int32_t;
  34. typedef llong     int64_t;
  35. typedef ullong    u_int64_t;
  36. typedef int       register_t;
  37.  
  38. #ifndef _POSIX_SOURCE
  39.   typedef uchar   u_char;
  40.   typedef ushort  u_short;
  41.   typedef uint    u_int;
  42.   typedef ulong   u_long;
  43. #endif
  44.  
  45. typedef ullong    u_quad_t;   /* quads */
  46. typedef llong     quad_t;
  47. typedef quad_t *  qaddr_t;
  48.  
  49. typedef char *    caddr_t;    /* core address */
  50. typedef int       daddr_t;    /* disk address */
  51. typedef short     dev_t;      /* device number */
  52. typedef uint      fixpt_t;    /* fixed point number */
  53. typedef ushort    gid_t;      /* group id */
  54. typedef uint      ino_t;      /* inode number */
  55. typedef long      key_t;      /* IPC key (for Sys V IPC) */
  56. typedef ushort    mode_t;     /* permissions */
  57. typedef ushort    nlink_t;    /* link count */
  58. typedef int       off_t;      /* file offset */
  59. typedef int       pid_t;      /* process id */
  60. typedef int       rlim_t;     /* resource limit */
  61. typedef int       segsz_t;    /* segment size */
  62. typedef int       swblk_t;    /* swap offset */
  63. typedef ushort    uid_t;      /* user id */
  64.  
  65. #ifdef  _BSD_CLOCK_T_
  66.   typedef _BSD_CLOCK_T_   clock_t;
  67.   #undef  _BSD_CLOCK_T_
  68. #endif
  69.  
  70. #ifdef  _BSD_SIZE_T_
  71.   typedef _BSD_SIZE_T_    size_t;
  72.   #undef  _BSD_SIZE_T_
  73. #endif
  74.  
  75. #ifdef  _BSD_SSIZE_T_
  76.   typedef _BSD_SSIZE_T_   ssize_t;
  77.   #undef  _BSD_SSIZE_T_
  78. #endif
  79.  
  80. #ifdef  _BSD_TIME_T_
  81.   typedef _BSD_TIME_T_    time_t;
  82.   #undef  _BSD_TIME_T_
  83. #endif
  84.  
  85. #ifndef _POSIX_SOURCE
  86. /* Major, minor numbers, dev_t's. */
  87. #define major(x)        ((int)(((uint)(x) >> 8) & 0xff))
  88. #define minor(x)        ((int)((x) & 0xff))
  89. #define makedev(x,y)    ((dev_t)(((x) << 8) | (y)))
  90.  
  91. #define NBBY    8             /* number of bits in a byte */
  92.  
  93. /*
  94.  * Select uses bit masks of file descriptors in longs.  These macros
  95.  * manipulate such bit fields (the filesystem macros use chars).
  96.  * FD_SETSIZE may be defined by the user, but the default here should
  97.  * be enough for most uses.
  98.  */
  99. #ifndef FD_SETSIZE
  100.  #define FD_SETSIZE      256
  101. #endif
  102.  
  103. typedef int fd_mask;
  104. #define NFDBITS (sizeof(fd_mask) * NBBY)  /* bits per mask */
  105.  
  106. #ifndef howmany
  107.   #define howmany(x, y)   (((x) + ((y) - 1)) / (y))
  108. #endif
  109.  
  110. typedef struct fd_set
  111. {
  112.   fd_mask fds_bits[howmany(FD_SETSIZE, NFDBITS)];
  113. } fd_set;
  114.  
  115. #define FD_SET(n, p)    ((p)->fds_bits[(n)/NFDBITS] |= (1 << ((n) % NFDBITS)))
  116. #define FD_CLR(n, p)    ((p)->fds_bits[(n)/NFDBITS] &= ~(1 << ((n) % NFDBITS)))
  117. #define FD_ISSET(n, p)  ((p)->fds_bits[(n)/NFDBITS] & (1 << ((n) % NFDBITS)))
  118. #define FD_COPY(f, t)   bcopy(f, t, sizeof(*(f)))
  119. #define FD_ZERO(p)      bzero(p, sizeof(*(p)))
  120. #endif /* _POSIX_SOURCE */
  121.  
  122. #endif /* SYS_TYPES_H */
  123.  
  124.